set ansi_nulls on
go
set quoted_identifier on
go

/*Add a new administrator account*/
if object_id('AddAdminInfo','p')is not null
drop procedure AddAdminInfo
go
create procedure AddAdminInfo
@Name nvarchar(50),
@Password nvarchar(50)
as
insert into AdminInfo
(
[Name],
[Password]
)
values
(
@Name,
@Password
)
go

/*Delete a exist administrator account*/
if object_id('DelAdminInfo','p')is not null
drop procedure DelAdminInfo
go
create procedure DelAdminInfo
@ID int
as
delete from AdminInfo where [ID] = @ID
go

/*Get the exist administrator account*/
if object_id('GetAdminInfo','p')is not null
drop procedure GetAdminInfo
go
create procedure GetAdminInfo
@Name nvarchar(50),
@Password nvarchar(50)
as 
select [ID],[Name],[Password] from AdminInfo where [Name]=@Name and [Password]=@Password
go

/*Update the the password of administrator account*/
if object_id('UpdateAdminInfo','p')is not null
drop procedure UpdateAdminInfo
go
create procedure UpdateAdminInfo
@ID int,
@Password nvarchar(50)
as
update AdminInfo set [Password] = @Password where [ID] = @ID

/*Add provisioning login data for admin*/
if object_id('AddProvisioningData','p') is not null
drop procedure AddProvisioningData
go
delete from AdminInfo where [Name] = 'Admin'
insert into AdminInfo values ('Admin','i@youhp')
go


